﻿@using MealBooking.Core.Models.Dishes;
@model DishCategory
@{
    Layout = "../Shared/_Layout.cshtml";
}
<!--Navbar-->
<div data-role="navbar" data-iconpos="left">
    <div class="float-left">
        <div data-role="controlgroup" data-type="horizontal" data-inset="true" data-mini="true">
            <a href="@Url.Action("DishCategoryDetail", "DishManager", new { id = Model.Id })" data-role="button">
                Cancel</a>
            <button data-theme="a">
                Delete</button>
        </div>
    </div>
    @Html.Partial("_FloatRightPartial")
</div>
<!--Navbar End-->
@using (Html.BeginForm("EditDishCategory", "DishManager"))
{
    <ul data-role="listview" data-inset="true" data-mini="true">
        <li data-role="list-divider">Details</li>
        @Html.HiddenFor(d => d.Id)
        <li data-role="fieldcontain">
            @Html.LabelFor(d => d.Name, "Name : ")
            @Html.TextBoxFor(d => d.Name)
            @Html.ValidationMessageFor(d => d.Name)
        </li>
        @if (ViewBag.SameNameDishCategory != null)
        {
            <li data-theme="e"><a href="@Url.Action("DishCategoryDetail", new { id = ViewBag.SameNameDishCategory.Id })">
                Name [@ViewBag.SameNameDishCategory.Name] Already in Use. Click to View Details</a></li>
        }
        @{
        var selectedMealCategoryId = Model.Category == null ? null : Model.Category.Id;
        Html.RenderAction("SingleMealCategoryPartial", new { mealCategoryId = selectedMealCategoryId });
        }
        @{ Html.RenderAction("ManyDishesPartial", new { id = Model.Id }); }
        <li data-role="fieldcontain">
            @Html.LabelFor(d => d.Description, "Description : ")
            @Html.TextBoxFor(d => d.Description)
        </li>
    </ul>
    <ul data-role="listview" data-inset="true" data-mini="true">
        <li data-role="list-divider"></li>
        <li data-role="fieldcontain">
            <div class="ui-grid-a">
                <div class="ui-block-a">
                    <input type="submit" value="Update" /></div>
                <div class="ui-block-b">
                    <input type="reset" value="Reset" /></div>
            </div>
        </li>
    </ul>
}
